$(function (){
  $("#gloUrl").attr("gloUValue","http://localhost:7002")
  // 下面是网络环境地址
  // $("#gloUrl").attr("gloUValue","http://www.young33.top:7002")
  // $.ajax({
  //   url: Glo_BaseUrl + "/selectRentEquipment",
  //   type: "get",
  //   data: {
  //     "userId":Glo_user
  //   },
  //   success: function (data) {
  //
  //   },
  //   error: function () {
  //     alert("服务器异常！network error！")
  //   }
  // })
})

function getRole(){
  let Glo_BaseUrl = $("#gloUrl").attr("gloUValue")
  let Glo_user = localStorage.getItem("userId")
  let role = "";
  $.ajax({
    url: Glo_BaseUrl + "/system/user/detail",
    type: "get",
    async:false,
    data: {
      "id":Glo_user
    },
    success: function (data) {
      role =  data.Data.role
    },
    error: function () {
      alert("服务器异常！network error！")
    }
  })
  return role;
}


function windowsAuto(code,msg){
  if (code === 200){
    swal("成功！", msg, "success");

  }else {
    swal("失败！", msg, "warning");

  }
}

//获取到角色，然后隐藏对应的菜单和按钮
function getRoleSetMenu(){
  let role = getRole()
  if (role === "1"){//用户
    $(".adminFun ").css({display:"none"})
    $(".userUnDo").css({display:"none"})
  }else if (role === "2"){//管理员

    $(".teacherFun ").css({display:"none"})
    $(".adminUnDo ").css({display:"none"})

  }else if (role === "3"){//teacher
    $(".adminFun ").css({display:"none"})

  }
}

